package cn.dankal.flyaudio.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewAdapter;
import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewHolder;
import cn.dankal.basiclib.pojo.JPushUserInfo;
import cn.dankal.basiclib.util.image.PicUtils;
import cn.dankal.flyaudio.R;

public class SearchFriendAdapter extends BaseRecyclerViewAdapter<JPushUserInfo> {
    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.item_contract_person;
    }

    @Override
    protected BaseRecyclerViewHolder getViewHolder(ViewGroup parent, View rootView, int viewType) {
        return new ViewHolder(rootView);
    }

    public class ViewHolder extends BaseRecyclerViewHolder<JPushUserInfo> {

        public ViewHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void onBindData(JPushUserInfo data, int position) {
            ImageView ivAvatar = itemView.findViewById(R.id.iv_avatar);
            PicUtils.loadAvatar(data.getAvatar(), ivAvatar);
            setText(R.id.tv_name, data.getUsername());
        }
    }
}
